const getTime = (value) => {
  let date = new Date(value);
  return date;
}
const againGroup = (data, num) => {
  var result = [];
  for (var i = 0, len = data.length; i < len; i += num) {
    result.push(data.slice(i, i + num));
  }
  return result;
}
const againGroup2 = (data, num) => {
  var result = [];
  for (var i = 0, len = data.length; i < len; i += num) {
    result.push(data.slice(i, i + num));
  }
  
  return result;
}
// const numberfilter=(num)=> {
//   const changeNum = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'] // changeNum[0] = "零"
//   const unit = ['', '十', '百']
//   num = parseInt(num)
//   const getWan = (temp) => {
//     const strArr = temp.toString().split('').reverse()
//     console.log(strArr);
//     let newNum = ''
//     for (var i = 0; i < strArr.length; i++) {
//       newNum = (i == 0 && strArr[i] == 0 ? '' : (i > 0 && strArr[i] == 0 && strArr[i - 1] == 0 ? '' : changeNum[strArr[i]] + (strArr[i] == 0 ? unit[0] : unit[i]))) + newNum
//     }
//     return newNum
//   }
//   const overWan = Math.floor(num / 100)
//   console.log(overWan);
//   let noWan = num % 100
//   console.log(noWan);
//   if (noWan.toString().length < 2) noWan = '0' + noWan
//   let strr = (overWan ? getWan(overWan) + '百' + getWan(noWan) : getWan(num))
//   console.log(strr.split('')[0]);
//   if(strr.split('')[0] == '一'){
//     console.log('123')
//     return strr.substring(1)
//   }else{
//     return overWan ? getWan(overWan) + '百' + getWan(noWan) : getWan(num)
//   }
// }
var chnNumChar = ["零","一","二","三","四","五","六","七","八","九"];
		var chnUnitSection = ["","万","亿","万亿","亿亿"];
		var chnUnitChar = ["","十","百","千"];
		function SectionToChinese(section){
			var strIns = '', chnStr = '';
			var unitPos = 0;
			var zero = true;
			while(section > 0){
				var v = section % 10;
				if(v === 0){
					if(!zero){
						zero = true;
						chnStr = chnNumChar[v] + chnStr;
					}
				}else{
					zero = false;
					strIns = chnNumChar[v];
					strIns += chnUnitChar[unitPos];
					chnStr = strIns + chnStr;
				}
				unitPos++;
				section = Math.floor(section / 10);
			}
			return chnStr;
		}
		const NumberToChinese=(num)=>{  
			  var unitPos = 0;  
			  var strIns = '', chnStr = '';  
			  var needZero = false;     
			  if(num === 0){  
			    return chnNumChar[0];  
			  }     
			  while(num > 0){  
			    var section = num % 10000;  
			    if(needZero){  
			      chnStr = chnNumChar[0] + chnStr;  
			    }  
			    strIns = SectionToChinese(section);  
			    strIns += (section !== 0) ? chnUnitSection[unitPos] : chnUnitSection[0];  
			    chnStr = strIns + chnStr;  
			    needZero = (section < 1000) && (section > 0);  
			    num = Math.floor(num / 10000);  
			    unitPos++;  
			  }
			  return chnStr;  
		}  
		// alert(NumberToChinese(123));
export {
  againGroup,
  againGroup2,
  NumberToChinese
}